package org.jeecg.modules.demo.ipds.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.jeecg.common.aspect.annotation.Dict;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;

import javax.xml.bind.annotation.*;
import java.io.Serializable;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

/**
 * @Description: 协议章节树
 * @Author: jeecg-boot
 * @Date:   2024-01-29
 * @Version: V1.0
 */
@Data
@TableName("ip_tree")
@XmlRootElement(name = "Protocol")
@XmlAccessorType(XmlAccessType.FIELD)
@ApiModel(value="ip_tree对象", description="协议章节树")
public class IpTree implements Serializable {
    private static final long serialVersionUID = 1L;

	/**主键*/
	@TableId(type = IdType.ASSIGN_ID)
    @ApiModelProperty(value = "主键")
    private java.lang.String id;
	/**创建人*/
    @ApiModelProperty(value = "创建人")
    private java.lang.String createBy;
	/**创建日期*/
	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "创建日期")
    private java.util.Date createTime;
	/**更新人*/
    @ApiModelProperty(value = "更新人")
    private java.lang.String updateBy;
	/**更新日期*/
	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "更新日期")
    private java.util.Date updateTime;
	/**所属部门*/
    @ApiModelProperty(value = "所属部门")
    private java.lang.String sysOrgCode;
	/**父级节点*/
	@Excel(name = "父级节点", width = 15)
    @ApiModelProperty(value = "父级节点")
    private java.lang.String pid;
	/**是否有子节点*/
	@Excel(name = "是否有子节点", width = 15, dicCode = "yn")
	@Dict(dicCode = "yn")
    @ApiModelProperty(value = "是否有子节点")
    private java.lang.String hasChild;
	/**section_name*/
	@Excel(name = "section_name", width = 15)
    @ApiModelProperty(value = "章节/协议名称")
    @XmlAttribute(name = "sectionName")
    private java.lang.String sectionName;
	/**(章节/协议)*/
	@Excel(name = "(章节/协议)", width = 15)
    @ApiModelProperty(value = "(章节/协议)")
    private java.lang.String type;

    @TableField(exist = false)
    private List<TreeByteList> byteList;


	/**内容*/
	@Excel(name = "内容", width = 15)
    @ApiModelProperty(value = "内容")
    private java.lang.String message;
	/**协议文档id*/
	@Excel(name = "协议文档id", width = 15)
    @ApiModelProperty(value = "协议文档id")
    private java.lang.String wordId;

    @TableField(exist = false)
    private String ipTreeId;

    @TableField(exist = false)
    private String ipTreeName;

    @TableField(exist = false)
    private List<IpTree> children;

    public enum IpTreeTypeEnum {
        SECTION("章节"),
        AGREEMENT("协议"),
        BYTE("字节"),
        SUBFRAME("子帧"),
        SUBFRAME_BYTE("子帧字节"),
        BIT("位");

        private final String name;

        IpTreeTypeEnum(String name) {
            this.name = name;
        }

        public String getName() {
            return name;
        }

        /**
         * @description: 获取所有的类型
         * @param
         * @return: java.util.List<org.jeecg.modules.demo.ipds.entity.IpTree.IpTreeTypeEnum>
         * @author: zhang
         * @date: 2024/3/30 13:38
         */
        public List<IpTreeTypeEnum> list(){
            return Arrays.stream(IpTreeTypeEnum.values()).collect(Collectors.toList());
        }
    }
}
